package com.bijava.files.model;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 老毕
 * @version 1.0
 * @since 2018.11.06
 */
@Data
public class ApiEntity<T> {
    @ApiModelProperty(value = "状态标识")
    private int code;
    @ApiModelProperty(value = "消息内容")
    private String msgs;
    private T data;

    private ApiEntity(int code, String msgs, T data) {
        this.code = code;
        this.msgs = msgs;
        this.data = data;
    }

    public static <T> ApiEntity success(String msgs,T data) {
        return new ApiEntity(200, msgs, data);
    }

    public static ApiEntity success(String message) {
        return new ApiEntity(200, message, null);
    }

    public static <T> ApiEntity error(String message) {
        return new ApiEntity(500, message, null);
    }
}